home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
compuserve-file-archive
/
05 Programming
/
CDT128.ARC
/
CDT.C
< prev
next >
Wrap
Text File
|
2019-04-13
|
7KB
|
212 lines
/*****************************************************************************/
/* */
/* C POWER DEBUGGING TOOL */
/* */
/* CDT */
/* */
/*****************************************************************************/
/***********************************************************************/
/***********************************************************************/
/* */
/* ╘HIS PROGRAM IS COPYRIGHT 1986 BY ┴LAN ┘ORINKS. ╔T MAY BE FREELY */
/* DISTRIBUTED FOR NON COMMERCIAL USAGE IF THIS COPYRIGHT NOTICE IS */
/* LEFT INTACT. ├OMMERCIAL USAGE OF THIS PROGRAM IS EXPLICITLY */
/* FORBIDDEN WITHOUT THE WRITTEN PERMISSION OF THE AUTHOR. */
/* */
/***********************************************************************/
/***********************************************************************/
/* CDT VERSION 1.0 PART 2 OF 15 ╩ULY 25, 1986 */
/* USAGE: -P PAGE CONTROL OFF. */
/* -R XXXX YY READ BYTE AT ADDRESS XXXX IN BANK YY. */
/* -W XXXX YY ZZ WRITE BYTE YY AT ADDRESS XXXX IN BANK ZZ.*/
/* -B VVVV... XXXX YYYY ZZ FIND NUMERICAL BYTE STRING,VVVV */
/* IN ADDRESS XXXX THROUGH YYYY IN */
/* BANK ZZ. */
/* -C "ABC..." XXXX YYYY ZZ FIND ALPHA STRING, ABC..., IN ADDRESS */
/* XXXX THROUGH YYYY IN BANK ZZ. */
/* -M XXXX YYYY ZZ DUMP MEMORY FROM ADDRESS XXXX THROUGH */
/* YYYY IN BANK ZZ */
/* -D XXXX YYYY ZZ DISASSEMBLE MEMORY FROM ADDRESS XXXX */
/* THROUGH YYYY IN BANK ZZ */
/* ╙╨┼├╔┴╠ ╬╧╘┼: ALL NUMERICAL VALUES ARE TO BE INPUT IN ╚┼╪ !!!! */
#INCLUDE <STDIO.H>
#INCLUDE "DBUG.H"
/*************************** GLOBAL STORAGE ****************************/
INT LNCNT ; /* COUNT OF LINES SENT TO OUTPUT DEVICE */
INT PAGE ; /* PAGE FLAG - ╘╥╒┼/╞┴╠╙┼ */
MAIN( ARGC, ARGV )
INT ARGC ;
CHAR *ARGV[] ;
█
AUTO CHAR C ; /* COMMAND CHARACTER */
AUTO INT COUNT ; /* ARGUMENT COUNT REGISTER */
AUTO INT (*GO)() ; /* EXECUTABLE FUNCTION POINTER */
EXTERN INT PRñUSAGE(), GETARGS() ;
EXTERN VOID DASMBL(), DUMP(), FIND(), READ(), WRITE(),
NULLñFUNC(), BYTEñSTRNG() ;
IF( ARGC < ═╔╬┴╥╟ ) /* TEST IF THERE ARE ANY ARGUMENTS PASSED */
█
PRñUSAGE(1) ; /* ERROR - NO PARAMETERS */
ABORT() ;
▌
/* COUNT WILL BE MAINTAINED BY EACH COMMAND PROCESS */
FOR( COUNT = 1, PAGE = ╘╥╒┼, LNCNT = 0, GO = NULLñFUNC ; COUNT < ARGC ; )
█
IF( ARGV[COUNT][0] != '-' ) /* PARAMETER MUST START WITH DASH */
█
PRñUSAGE(2) ;
ABORT() ;
▌
SWITCH( C = ARGV[COUNT][1] ) /* GET PARAMETER CHARACTER */
█
CASE 'P':
COUNT++ ;
PAGE = ╞┴╠╙┼ ;
BREAK ;
CASE 'D':
TESTCMD( GO ) ;
COUNT++ ;
/* TEST IF THERE ARE ENOUGH ARGUMENTS FOR COMMAND */
IF ( (ARGC - COUNT) < 3)
█
PRñUSAGE(8) ;
ABORT() ;
▌
IF( GETARGS( ARGV, &COUNT, ─┴╙═┬╠ ) == ┴╥╟┼╥╥ )
█
PRñUSAGE(4) ;
ABORT() ;
▌
GO = DASMBL ;
BREAK ;
CASE 'M':
TESTCMD( GO ) ;
COUNT++ ;
IF ( (ARGC - COUNT) < 3)
█
PRñUSAGE(8) ;
ABORT() ;
▌
IF( GETARGS( ARGV, &COUNT, ─╒═╨ ) == ┴╥╟┼╥╥ )
█
PRñUSAGE(4) ;
ABORT() ;
▌
GO = DUMP ;
BREAK ;
CASE 'R':
TESTCMD( GO ) ;
COUNT++ ;
IF ( (ARGC - COUNT) < 2)
█
PRñUSAGE(8) ;
ABORT() ;
▌
IF( GETARGS( ARGV, &COUNT, ╥┼┴─ ) == ┴╥╟┼╥╥ )
█
PRñUSAGE(4) ;
ABORT() ;
▌
GO = READ ;
BREAK ;
CASE 'W':
TESTCMD( GO ) ;
COUNT++ ;
IF ( (ARGC - COUNT) < 3)
█
PRñUSAGE(8) ;
ABORT() ;
▌
IF( GETARGS( ARGV, &COUNT, ╫╥╔╘┼ ) == ┴╥╟┼╥╥ )
█
PRñUSAGE(4) ;
ABORT() ;
▌
GO = WRITE ;
BREAK ;
CASE 'B':
CASE 'C':
TESTCMD( GO ) ;
COUNT++ ;
IF ( (ARGC - COUNT) < 4)
█
PRñUSAGE(8) ;
ABORT() ;
▌
IF( GETARGS( ARGV, &COUNT, ╞╔╬─ ) == ┴╥╟┼╥╥ )
█
PRñUSAGE(4) ;
ABORT() ;
▌
IF( C == 'B' )
BYTEñSTRNG() ;
GO = FIND ;
BREAK ;
DEFAULT :
PRñUSAGE(5) ;
ABORT() ;
▌
▌
(*GO)() ; /* EXECUTE COMMAND */
PRINTF("\N") ;
▌
/* A TEST FOR THE FUNCTION POINTER BEING SET TO SOMETHING OTHER THAN */
/* NULLñFUNC, MUST BE PERFORMED FOR EACH CASE SO THAT POSITION */
/* INDEPENDENCE OF COMMAND ARGUMENTS MAY BE PROVIDED FOR THE */
/* COMMAND LINE. */
VOID
TESTCMD( FPTR )
VOID (*FPTR)() ;
█
EXTERN VOID NULLñFUNC(), PRñUSAGE(), ABORT() ;
IF( FPTR != &NULLñFUNC )
█
PRñUSAGE(3) ;
ABORT() ;
▌
▌
VOID
NULLñFUNC()
█
EXTERN VOID PRñUSAGE() ;
PRñUSAGE(7) ;
▌